package com.example.hongyu.avtt.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.example.hongyu.avtt.R;
import com.example.hongyu.avtt.model.Html;
import com.example.hongyu.avtt.ui.base.BaseAdapter;
import com.example.hongyu.avtt.ui.base.BaseViewHolder;

import java.util.List;

import butterknife.BindView;

public class HtmlListAdapter extends BaseAdapter<Html,HtmlListAdapter.ViewHolder> {


    public HtmlListAdapter(Context context, List<Html> list) {
        super(context, list);
    }

    @Override
    public int getItemView() {
        return R.layout.html_list_item_view;
    }

    @Override
    protected ViewHolder getViewHolder(View itemView) {
        return new ViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        Html html= mList.get(position);
        holder.name.setText(html.getName());
        holder.supplier.setText(html.getTitle());
        holder.score.setText(html.getUrl());
        holder.date.setText(html.getName());

    }
    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.item_name)
        TextView name;
        @BindView(R.id.item_supplier)
        TextView supplier;
        @BindView(R.id.item_score)
        TextView score;
        @BindView(R.id.item_date)
        TextView date;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }
}
